package com.lxw.producer;

import com.lxw.config.RabbitConfig;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

@RunWith(SpringRunner.class)
@SpringBootTest
public class Producer05_topics_springboot {

    @Autowired
    private  RabbitTemplate rabbitTemplate;

    @Test
    public void sendMessage(){
        String message = "hello";
        rabbitTemplate.convertAndSend(RabbitConfig.EXCHANGE_TOPIC,"routing.sms",message);
        System.out.println("send sms message"+message);
    }
}
